package com.ftg.learn.mapper;

import com.ftg.learn.pojo.Car;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CarMapper {
    //查询全部
    @Select("select * from car limit #{arg0},#{arg1}")
    public List<Car> showall(int begin, int end);
    //共计多少条
    @Select("select count(*) from car")
    int getcount();
    //查一
    @Select("select * from car where car_id = ifnull(cncat(#{car_id},%),car_id) or car_name like ifnull(cconct(#{car_name},%),car_name)")
    public List<Car> findone(String car_id, String car_name);
    //添加
    @Insert("insert into car(car_id,car_name,car_xinghao,car_img)values(#{car_id},#{car_name},#{car_xinghao},#{car_img})")
    public List<Car> add(Car car);
    //删除
    @Delete("delete from car where car_id = #{car_id}")
    public int delete(String car_id);
    //修改
    @Update("update car set car_id = #{car_id},car_name = #{car_name},car_xinghao = #{car_xinghao},car_img = #{car_img}")
    public int update(Car car);



}
